﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Cadastros/Site.Master" AutoEventWireup="true" CodeBehind="Adm.aspx.cs" Inherits="CongregacaoOs.WebForm.Cadastros.Adm" %>

<%@ Register Src="~/Cadastros/MessageWindow.ascx" TagPrefix="uc1" TagName="MessageWindow" %>


<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">



    <script type="text/javascript">

        $(document).ready(function () {
            var activeIndex = parseInt($('#<%=hfIndexAccordion.ClientID %>').val());



            $("#accordion").accordion({
                collapsible: true,
                autoHeight: false,
                navigation: true,
                active: activeIndex,
                change: function (event, ui) {
                    var index = $(this).children('h3').index(ui.newHeader);
                    $('#<%=hfIndexAccordion.ClientID %>').val(index);
                }
            });
        });

    </script>
    <style type="text/css">
        #resizable {
            width: 450px;
            height: 177px;
            padding: 0.5em;
        }

            #resizable h3 {
                text-align: center;
                margin: 0;
            }

        .ui-resizable-helper {
            border: 1px dotted gray;
        }


        .auto-style1 {
            width: 40px;
        }

        .auto-style4 {
            width: 240px;
        }

        .auto-style5 {
            width: 47px;
        }

        .auto-style7 {
            width: 129px;
        }
    </style>

    <link href="../Content/NewTheme/gridView.css" rel="stylesheet" />

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
    <p>
    </p>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <asp:HiddenField ID="hfIndexAccordion" runat="server" />

    <div id="accordion">
        <h3><a href="#">Consultar</a></h3>
        <div>
            <asp:Panel ID="PainelConsulta" runat="server" Style="width: 70%; margin: 0 auto;">
                <h2>Cadastro de Administração</h2>
                <hr />
                <br />
                <table width="100%">
                    <tr>
                        <td></td>
                        <td>Administração:<br />
                            <asp:TextBox ID="txtBuscarNome" Width="100%" runat="server"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>Regional:<br />
                            <asp:DropDownList ID="dropRegionalFiltro" DataTextField="regional" DataValueField="idRegional" runat="server" AutoPostBack="True" Height="22px" Width="300px" OnDataBound="dropRegionalFiltro_DataBound" OnSelectedIndexChanged="dropRegionalFiltro_SelectedIndexChanged">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>Distrital:<br />
                            <asp:DropDownList ID="dropDistritalFiltro" DataTextField="distrital" DataValueField="idDistrital" runat="server" AutoPostBack="True" Height="22px" Width="300px" OnDataBound="dropDistritalFiltro_DataBound" OnSelectedIndexChanged="dropDistritalFiltro_SelectedIndexChanged"></asp:DropDownList>
                        </td>
                    </tr>
                </table>

                <br />
                <hr />
                <asp:GridView ID="gvAdministracao" runat="server" Style="font-size: smaller;"
                    AutoGenerateColumns="False"
                    AllowPaging="True"
                    CssClass="mGrid"
                    PagerStyle-CssClass="pgr"
                    AlternatingRowStyle-CssClass="alt" OnPageIndexChanging="gvAdministracao_PageIndexChanging" OnRowCommand="gvAdministracao_RowCommand" OnRowDataBound="gvAdministracao_RowDataBound" PageSize="7">
                    <AlternatingRowStyle CssClass="alt" />
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:ImageButton ImageUrl="~/Images/EditDeleteGrid/Edit.png" CommandName="EDITAR" CommandArgument="<%# Bind('idAdm') %>" ToolTip="Editar" runat="server" Width="20px" ID="imgEditar" />
                                &nbsp;&nbsp;&nbsp;
                                <asp:ImageButton ImageUrl="~/Images/EditDeleteGrid/Delete.png" CommandName="EXCLUIR" runat="server" CommandArgument="<%# Bind('idAdm') %>" ToolTip="Excluir" Width="20px" ID="imgDelete" />

                                <asp:HiddenField ID="hdIdAdm" runat="server" Value="<%# Bind('idAdm') %>" />
                                <asp:HiddenField ID="hdRegional" runat="server" Value="<%# Bind('Regional') %>" />
                                <asp:HiddenField ID="hdDistrital" runat="server" Value="<%# Bind('Distrital') %>" />
                            </ItemTemplate>
                            <ItemStyle Width="15%" HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="idAdm" HeaderText="Código" HtmlEncode="False">
                            <ItemStyle Width="5%" HorizontalAlign="Center" />
                            <HeaderStyle HorizontalAlign="Center" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Adm" HeaderText="Adm" HtmlEncode="false">
                            <ItemStyle Width="27%" HorizontalAlign="Left" />
                            <HeaderStyle HorizontalAlign="Left" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Regional" HeaderText="Regional" HtmlEncode="false">
                            <ItemStyle Width="28%" HorizontalAlign="Left" />
                            <HeaderStyle HorizontalAlign="Left" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Distrital" HeaderText="Distrital" HtmlEncode="false">
                            <ItemStyle Width="25%" HorizontalAlign="Left" />
                            <HeaderStyle HorizontalAlign="Left" />
                        </asp:BoundField>
                    </Columns>
                    <EmptyDataTemplate>
                        Nenhum registro encontrado...
                    </EmptyDataTemplate>
                    <PagerStyle CssClass="pgr" />
                </asp:GridView>
                <div style="float: left;">
                    <asp:Button ID="btnBuscar" runat="server" Text="Pesquisar" OnClick="btnBuscar_Click" />
                    <asp:Button ID="btnAdicionarNovo" class="btnSalvar" runat="server" Text="Adicionar" OnClick="btnAdicionarNovo_Click" />
                </div>
            </asp:Panel>
        </div>
        <h3><a href="#">Cadastrar/Editar</a></h3>
        <div>
            <asp:Panel ID="painelCadastro" runat="server" Style="width: 70%; margin: 0 auto;">
                <asp:HiddenField ID="hdID" runat="server" />

                <asp:UpdatePanel runat="server" ID="pnlAtualizar">
                    <ContentTemplate>
                        <label>Nome:</label><br />
                        <asp:TextBox ID="txtNome" runat="server" Width="100%"></asp:TextBox><br />

                        <label>Regional</label>
                        <br />
                        <asp:DropDownList ID="dropRegional" runat="server" DataTextField="regional" DataValueField="idRegional" Height="25px" Width="310px" AutoPostBack="True" OnSelectedIndexChanged="dropRegional_SelectedIndexChanged" OnDataBound="dropRegional_DataBound"></asp:DropDownList><br />
                        <label>Distrital</label>
                        <br />
                        <asp:DropDownList ID="dropDistrital" runat="server" DataTextField="distrital" DataValueField="idDistrital" Height="25px" Width="310px" OnDataBound="dropDistrital_DataBound"></asp:DropDownList><br />

                    </ContentTemplate>
                </asp:UpdatePanel>

                <asp:Panel ID="Panel1" runat="server" Visible="true">

                    <br />
                    <div id="resizable" class="ui-widget-content">
                        <h3 class="ui-widget-header">Setores da Administração</h3>
                        <table>
                            <tr>
                                <td>
                                    <asp:ListBox ID="listSetores" DataTextField="nome" DataValueField="idSetor"
                                        runat="server" Height="152px" Width="174px"></asp:ListBox>
                                </td>
                                <td>
                                    <asp:Button ID="btnAdd" runat="server" Text=">" Width="93px" OnClick="btnAdd_Click" />
                                    <br />
                                    <asp:Button ID="btnRemove" runat="server" Text="<" Width="93px" OnClick="btnRemove_Click" />
                                    <br />
                                    <asp:Button ID="btnAddAll" runat="server" Text=">>" Width="93px" OnClick="btnAddAll_Click" />
                                    <br />
                                    <asp:Button ID="btnRemoveAll" runat="server" Text="<<" Width="93px" OnClick="btnRemoveAll_Click" />
                                    <br />
                                </td>
                                <td>
                                    <asp:ListBox ID="listSetoresResult" runat="server" Height="152px" Width="174px"></asp:ListBox>
                                </td>
                            </tr>
                        </table>
                    </div>


                    <br />
                    <br />


                </asp:Panel>
                <asp:Button ID="btnSalvar" class="btnSalvar" runat="server" Text="Salvar" OnClick="btnSalvar_Click" />
                <asp:Button ID="btnVoltar" class="btnSalvar" runat="server" Text="Voltar" OnClientClick="ChangeAccordion();" OnClick="btnVoltar_Click" />
            </asp:Panel>
            <uc1:MessageWindow runat="server" ID="MessageWindow" />
        </div>
    </div>




</asp:Content>
